# # -*- encoding: utf-8 -*-
# """
# @File    : play_dice.py
# @Time    : 2020/10/20 17:31
# @Author  : lluyao
# @Email   : lluyao61@163.com
# @Software: PyCharm
# """
# import random
#
# n = int(0)
# m = int(0)
# bean = int(1000)
# print("欢迎来到游戏，赠送您1000金豆。猜对赢100金豆，猜错扣100金豆。当全都用完时退出游戏。")
# while bean > 0:
#     # 随机生成三个骰子
#     dice1 = random.randint(1, 6)
#     dice2 = random.randint(1, 6)
#     dice3 = random.randint(1, 6)
#     print(dice1 + dice2 + dice3)
#     # 用户猜测大小
#     user = input("请输入你猜测的结果（大/小):")
#     # 判断
#     if 3 <= dice1 + dice2 + dice3 <= 10:
#         if user == '小':
#             print("成功！")
#             n += 1
#             bean += 100
#         elif user == '大':
#             print("失败。")
#             m += 1
#             bean -= 100
#         elif user == 'exit':
#             num = int(n + m)
#             rate = float(n / (m + n))
#             print(f"您共进行{num}次游戏,胜率为{rate}")
#             print(f"您剩余{bean}个金豆。")
#             break
#         else:
#             print("您的输入有误，本次不计数。")
#     elif 11 <= dice1 + dice2 + dice3 <= 18:
#         if user == '小':
#             print("失败。")
#             m += 1
#             bean -= 100
#         elif user == '大':
#             print("成功！")
#             n += 1
#             bean += 100
#         elif user == 'exit':
#             num = int(n + m)
#             rate = float(n / (m + n))
#             print(f"您共进行{num}次游戏,胜率为{rate}")
#             print(f"您剩余{bean}个金豆。")
#             break
#         else:
#             print("您的输入有误，本次不计数。")
#
# else:
#     num = int(n + m)
#     rate = float(n / (m + n))
#     print(f"您的金豆已用尽。您共进行{num}次游戏,胜率为{rate}")





